package Negocio;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

import Persistencia.PersistirDados;

@SuppressWarnings("serial")
public class Departamento implements Serializable {
	private String nome;
	private List<Professor> listaProf;
	private Professor professor;
	private List<Disciplina> disciplinas;
	private Disciplina disciplina;



	public List<Disciplina> getDisciplina() {
		return disciplinas;
	}
	public void setDisciplina(List<Disciplina> disciplina) {
		this.disciplinas = disciplina;
	}


	public Departamento(String nome){
		this.setNome(nome);

	}
	public Departamento() {
		this.listaProf =new LinkedList<Professor>();
		this.disciplinas=new LinkedList<Disciplina>();
		this.professor =new Professor();
		try {
			listaProf=PersistirDados.recuperaUsandoArquivos();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public List<Professor> getListaProf() {
		return listaProf;
	}

	public void cadastraProf(String nome, String matricula) {
		//  this.listaProf=new LinkedList<Professor>();


		this.professor=new Professor(nome, matricula);
		this.listaProf.add(professor);

		try {
			PersistirDados.salvaProfessor(listaProf);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void cadastraDisciplina(String nome, String codigo, List<Professor> professor){
		this.disciplina=new Disciplina(nome,codigo,professor);


		this.disciplinas.add(disciplina);
	}

	public void setNome(String nome) {
		this.nome = nome;
	}
	public String getNome() {
		return nome;
	}







}